How to create a windows directory

i am trying to create a windows directory and a text file under the new directory. if the directory already exists, i just want to create the file. I am getting an access error "can not open the folder".
For example,

Stream outF

string dirname="c\temp\foldername"
string filename="test.txt"

if(!fielExists(dirname"."))
{
mkdir(dirname, "") // how to give access to everyone??????
outF=write(dirname filename)
}
else
{
outF=write(dirname filename)
}
faisal.zahidi@boeing.com - Fri Mar 25 12:47:55 EDT 2011

Re: How to create a windows directory
Mathias Mamsch - Fri Mar 25 12:57:08 EDT 2011

Dude ... reposting will not help you to get quicker anwers!

If DOORS tells you "cannot open the folder", then this is probably the case. Did you maybe forget to escape your backslashes??

e.g.:
 

NOT:  filename= "C:\temp\..."
BUT:  filename= "C:\\temp\\..."

 


Regards, Mathais

 

 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

 

 

Re: How to create a windows directory
llandale - Fri Mar 25 15:13:13 EDT 2011

Didn't try to run it, but perhaps the following:

Stream outF
 
string dirname="c\\temp\\foldername"   //** ESCAPE slashes
string filename="test.txt"
 
if(!fileExists(dirname))  // **fileExists.  Don't need period
{
   mkdir(dirname, "") // how to give access to everyone??????
   outF=write(dirname "\\" filename)  // ** separate file name from folder
}
else
{
outF=write(dirname "\\" filename)  //** ditto
}


its OK to "mkdir" on an existing directory, just ignore the errors.

Don't know about "rights" nor "mode", so I would use "mkdir(dirname)".

 

 

  • Louie